<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>知识库 - 机勘院智能业务系统</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.4/css/all.min.css" rel="stylesheet">
    <link href="../css/main.css" rel="stylesheet">
</head>
<body class="deepseek-admin">
    <!-- 顶部导航栏 -->
    <header class="deepseek-header">
        <div class="container-fluid">
            <div class="row align-items-center">
                <div class="col">
                    <button id="sidebarToggle" class="btn btn-link text-white">
                        <i class="fas fa-bars"></i>
                    </button>
                    <span class="ms-2 fw-bold">知识库</span>
                </div>
                <div class="col-auto">
                    <div class="d-flex align-items-center">
                        <button id="toggleDarkMode" class="btn btn-link text-white me-3" title="切换暗色模式">
                            <i class="fas fa-moon"></i>
                        </button>
                        <div class="dropdown">
                            <button class="btn btn-link text-white dropdown-toggle" data-bs-toggle="dropdown">
                                <i class="fas fa-user-circle"></i>
                            </button>
                            <ul class="dropdown-menu dropdown-menu-end">
                                <li><a class="dropdown-item" href="#"><i class="fas fa-user me-2"></i>个人信息</a></li>
                                <li><a class="dropdown-item" href="#"><i class="fas fa-cog me-2"></i>账号设置</a></li>
                                <li><hr class="dropdown-divider"></li>
                                <li><a class="dropdown-item" href="#"><i class="fas fa-sign-out-alt me-2"></i>退出登录</a></li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </header>

    <!-- 侧边栏 -->
    <nav class="deepseek-sidebar">
        <div class="deepseek-sidebar-content">
            <div class="deepseek-logo mb-4">
                <img src="../images/logo.png" alt="智能业务 Logo">
            </div>
            <ul class="deepseek-nav">
                <li>
                    <a href="#" class="deepseek-nav-item active" data-tab="all-docs">
                        <i class="fas fa-book"></i>
                        <span>全部文档</span>
                    </a>
                </li>
                <li>
                    <a href="#" class="deepseek-nav-item" data-tab="categories">
                        <i class="fas fa-folder"></i>
                        <span>分类管理</span>
                    </a>
                </li>
                <li>
                    <a href="#" class="deepseek-nav-item" data-tab="tags">
                        <i class="fas fa-tags"></i>
                        <span>标签管理</span>
                    </a>
                </li>
                <li>
                    <a href="#" class="deepseek-nav-item" data-tab="favorites">
                        <i class="fas fa-star"></i>
                        <span>收藏文档</span>
                    </a>
                </li>
                <li>
                    <a href="#" class="deepseek-nav-item" data-tab="recycle">
                        <i class="fas fa-trash-alt"></i>
                        <span>回收站</span>
                    </a>
                </li>
            </ul>
        </div>
    </nav>

    <!-- 主要内容区域 -->
    <main class="deepseek-main">
        <div class="container-fluid py-4">
            <!-- 工具栏 -->
            <div class="mb-4">
                <div class="row align-items-center">
                    <div class="col">
                        <div class="btn-group">
                            <button class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addDocModal">
                                <i class="fas fa-plus me-1"></i>新建文档
                            </button>
                            <button class="btn btn-outline-secondary" data-bs-toggle="modal" data-bs-target="#importModal">
                                <i class="fas fa-file-import me-1"></i>导入文档
                            </button>
                        </div>
                    </div>
                    <div class="col-auto">
                        <div class="input-group">
                            <input type="text" class="form-control" placeholder="搜索知识库...">
                            <button class="btn btn-outline-secondary">
                                <i class="fas fa-search"></i>
                            </button>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 知识库内容 -->
            <div class="row">
                <!-- 左侧分类树 -->
                <div class="col-md-3">
                    <div class="card">
                        <div class="card-header">
                            <div class="d-flex justify-content-between align-items-center">
                                <span>知识分类</span>
                                <button class="btn btn-sm btn-outline-primary" data-bs-toggle="modal" data-bs-target="#addCategoryModal">
                                    <i class="fas fa-plus"></i>
                                </button>
                            </div>
                        </div>
                        <div class="card-body p-0">
                            <div class="list-group list-group-flush" id="categoryTree">
                                <a href="#" class="list-group-item list-group-item-action active">
                                    <i class="fas fa-folder-open me-2"></i>道路勘察
                                    <span class="badge bg-secondary float-end">12</span>
                                </a>
                                <a href="#" class="list-group-item list-group-item-action ps-4">
                                    <i class="fas fa-file-alt me-2"></i>勘察规范
                                    <span class="badge bg-secondary float-end">5</span>
                                </a>
                                <a href="#" class="list-group-item list-group-item-action ps-4">
                                    <i class="fas fa-file-alt me-2"></i>技术标准
                                    <span class="badge bg-secondary float-end">7</span>
                                </a>
                                <a href="#" class="list-group-item list-group-item-action">
                                    <i class="fas fa-folder me-2"></i>地质分析
                                    <span class="badge bg-secondary float-end">8</span>
                                </a>
                                <a href="#" class="list-group-item list-group-item-action">
                                    <i class="fas fa-folder me-2"></i>工程造价
                                    <span class="badge bg-secondary float-end">6</span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 右侧文档列表 -->
                <div class="col-md-9">
                    <div class="card">
                        <div class="card-header">
                            <div class="row align-items-center">
                                <div class="col">
                                    <div class="btn-group btn-group-sm">
                                        <button class="btn btn-outline-secondary active">
                                            <i class="fas fa-th-large"></i>
                                        </button>
                                        <button class="btn btn-outline-secondary">
                                            <i class="fas fa-list"></i>
                                        </button>
                                    </div>
                                </div>
                                <div class="col-auto">
                                    <select class="form-select form-select-sm">
                                        <option value="updated">最近更新</option>
                                        <option value="created">创建时间</option>
                                        <option value="name">名称</option>
                                        <option value="views">浏览次数</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="card-body">
                            <div class="row g-3" id="docGrid">
                                <!-- 文档卡片 -->
                                <div class="col-md-4">
                                    <div class="doc-card">
                                        <div class="doc-card-header">
                                            <i class="fas fa-file-alt fa-2x text-primary"></i>
                                            <div class="dropdown">
                                                <button class="btn btn-link" data-bs-toggle="dropdown">
                                                    <i class="fas fa-ellipsis-v"></i>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-end">
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-edit me-2"></i>编辑</a></li>
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-star me-2"></i>收藏</a></li>
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-share me-2"></i>分享</a></li>
                                                    <li><hr class="dropdown-divider"></li>
                                                    <li><a class="dropdown-item text-danger" href="#"><i class="fas fa-trash-alt me-2"></i>删除</a></li>
                                                </ul>
                                            </div>
                                        </div>
                                        <div class="doc-card-body">
                                            <h6 class="doc-title">道路勘察技术规范v2.0</h6>
                                            <p class="doc-meta">
                                                <small class="text-muted">
                                                    <i class="fas fa-clock me-1"></i>2025-03-01
                                                </small>
                                                <small class="text-muted ms-2">
                                                    <i class="fas fa-eye me-1"></i>128
                                                </small>
                                            </p>
                                            <div class="doc-tags">
                                                <span class="badge bg-primary">规范</span>
                                                <span class="badge bg-info">技术</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                                <div class="col-md-4">
                                    <div class="doc-card">
                                        <div class="doc-card-header">
                                            <i class="fas fa-file-alt fa-2x text-success"></i>
                                            <div class="dropdown">
                                                <button class="btn btn-link" data-bs-toggle="dropdown">
                                                    <i class="fas fa-ellipsis-v"></i>
                                                </button>
                                                <ul class="dropdown-menu dropdown-menu-end">
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-edit me-2"></i>编辑</a></li>
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-star me-2"></i>收藏</a></li>
                                                    <li><a class="dropdown-item" href="#"><i class="fas fa-share me-2"></i>分享</a></li>
                                                    <li><hr class="dropdown-divider"></li>
                                                    <li><a class="dropdown-item text-danger" href="#"><i class="fas fa-trash-alt me-2"></i>删除</a></li>
                                                </ul>
                                            </div>
                                        </div>
                                        <div class="doc-card-body">
                                            <h6 class="doc-title">地质勘察报告模板</h6>
                                            <p class="doc-meta">
                                                <small class="text-muted">
                                                    <i class="fas fa-clock me-1"></i>2025-02-28
                                                </small>
                                                <small class="text-muted ms-2">
                                                    <i class="fas fa-eye me-1"></i>96
                                                </small>
                                            </p>
                                            <div class="doc-tags">
                                                <span class="badge bg-success">模板</span>
                                                <span class="badge bg-warning">必读</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <!-- 新建文档模态框 -->
    <div class="modal fade" id="addDocModal" tabindex="-1">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">新建文档</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <form id="addDocForm">
                        <div class="mb-3">
                            <label class="form-label">文档标题</label>
                            <input type="text" class="form-control" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">所属分类</label>
                            <select class="form-select">
                                <option value="">选择分类...</option>
                                <option value="1">道路勘察</option>
                                <option value="2">地质分析</option>
                                <option value="3">工程造价</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">标签</label>
                            <input type="text" class="form-control" placeholder="输入标签，用逗号分隔">
                        </div>
                        <div class="mb-3">
                            <label class="form-label">文档内容</label>
                            <div id="editor">
                                <!-- 富文本编辑器将在这里初始化 -->
                            </div>
                        </div>
                        <div class="mb-3">
                            <div class="form-check">
                                <input class="form-check-input" type="checkbox" id="enableAI">
                                <label class="form-check-label" for="enableAI">
                                    启用AI辅助编写
                                </label>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="saveDoc">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 导入文档模态框 -->
    <div class="modal fade" id="importModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">导入文档</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <div class="upload-area mb-3">
                        <div class="text-center p-5 border rounded">
                            <i class="fas fa-file-import fa-3x text-muted mb-3"></i>
                            <p class="mb-0">拖放文件到此处或点击选择文件</p>
                            <input type="file" class="d-none" id="importFile" multiple accept=".doc,.docx,.pdf,.md">
                        </div>
                    </div>
                    <div class="import-options">
                        <div class="form-check mb-2">
                            <input class="form-check-input" type="checkbox" id="extractContent">
                            <label class="form-check-label" for="extractContent">
                                自动提取文档内容
                            </label>
                        </div>
                        <div class="form-check mb-2">
                            <input class="form-check-input" type="checkbox" id="generateTags">
                            <label class="form-check-label" for="generateTags">
                                AI生成标签
                            </label>
                        </div>
                        <div class="form-check">
                            <input class="form-check-input" type="checkbox" id="addToCategory">
                            <label class="form-check-label" for="addToCategory">
                                自动分类
                            </label>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="startImport">开始导入</button>
                </div>
            </div>
        </div>
    </div>

    <!-- 新建分类模态框 -->
    <div class="modal fade" id="addCategoryModal" tabindex="-1">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">新建分类</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <form id="addCategoryForm">
                        <div class="mb-3">
                            <label class="form-label">分类名称</label>
                            <input type="text" class="form-control" required>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">上级分类</label>
                            <select class="form-select">
                                <option value="">无</option>
                                <option value="1">道路勘察</option>
                                <option value="2">地质分析</option>
                                <option value="3">工程造价</option>
                            </select>
                        </div>
                        <div class="mb-3">
                            <label class="form-label">描述</label>
                            <textarea class="form-control" rows="3"></textarea>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">取消</button>
                    <button type="button" class="btn btn-primary" id="saveCategory">保存</button>
                </div>
            </div>
        </div>
    </div>

    <!-- JavaScript依赖 -->
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@tinymce/tinymce-webcomponent@2.0.1/dist/tinymce-webcomponent.min.js"></script>
    <script src="../js/knowledge.js"></script>
</body>
</html> 